package cn.jellybmedia.basic.config;

import cn.jellybmedia.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.transform.impl.AddInitTransformer;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**======================================================================================
* @Title:
* @Description: 前端拦截器配置类
* @Author: Mr.Zhang
* @Version: 1.0
* @Date:  2022/7/7 17:23
* @Parameters:
* @Return
======================================================================================*/
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**") // 拦截所有
                .excludePathPatterns("/login/**") // 放行路径
                .excludePathPatterns("/fastDFs/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/shop/settlement")
                .excludePathPatterns("/user/login/**")
                .excludePathPatterns("/user/register/**");
    }
}
